<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:th="http://www.thymeleaf.org" lang="zh-CN">

<div th:fragment="content">
    <p class="text-muted">转换配置</p>

    <div class="form-group">
        <div class="row">
            <div class="col-md-4">
                <label class="col-sm-3 control-label text-right">转换</label>
                <div class="col-sm-9">
                    <select id="convertOperator" class="form-control select-control">
                        <option th:value="${c?.code}" th:text="${c?.name}" th:argNum="${c?.argNum}" th:each="c,state : ${convert}"/ >
                    </select>
                </div>
            </div>
            <div class="col-md-4">
                <label class="col-sm-3 control-label text-right">目标源表字段</label>
                <div class="col-sm-9">
                    <select id="convertTargetField" class="form-control select-control">
                        <!-- 目标源表公共字段 -->
                        <option th:if="${tableGroup} == null" th:each="c,s:${mapping?.targetColumn}" th:value="${c?.name}" th:text="${c?.name} +' (' + ${c?.typeName} +')'" />

                        <!-- 目标源表字段 -->
                        <option th:each="c,s:${tableGroup?.targetTable?.column}" th:value="${c?.name}" th:text="${c?.name} +' (' + ${c?.typeName} +')'" />
                    </select>
                </div>
            </div>
            <div class="col-md-4">
                <label class="col-sm-2 control-label text-right">参数</label>
                <div class="col-sm-5">
                    <input class="form-control convertArg" type="text" maxlength="50" placeholder="参数" />
                </div>
                <div class="col-sm-5">
                    <input class="form-control convertArg" type="text" maxlength="50" placeholder="参数" />
                </div>
            </div>
        </div>
    </div>

    <div class="form-group">
        <div class="row">
            <div class="col-md-11"></div>
            <div class="col-md-1">
                <button id="convertAdd" type="button" class="btn btn-primary">
                    <span class="fa fa-plus"></span>添加
                </button>
            </div>
        </div>
    </div>

    <div class="form-group">
        <div class="row">
            <div class="col-md-1"></div>
            <div class="col-md-11">
                <table id="convertTable" class="table table-hover hidden">
                    <thead>
                        <tr>
                            <th>转换</th>
                            <th>目标源表字段</th>
                            <th>参数</th>
                            <th>操作</th>
                        </tr>
                    </thead>
                    <tbody id="convertList">
                        <!-- Mapping convert -->
                        <tr th:if="${tableGroup} == null" th:each="f,s:${mapping?.convert}">
                            <td th:value="${f?.convertCode}">[[${f?.convertName}]]</td>
                            <td>[[${f?.name}]]</td>
                            <td>[[${f?.args}]]</td>
                            <td><a class='fa fa-remove fa-2x convertDelete dbsyncer_pointer' title='删除' ></a></td>
                        </tr>
                        <!-- TableGroup convert -->
                        <tr th:each="f,s:${tableGroup?.convert}">
                            <td th:value="${f?.convertCode}">[[${f?.convertName}]]</td>
                            <td>[[${f?.name}]]</td>
                            <td>[[${f?.args}]]</td>
                            <td><a class='fa fa-remove fa-2x convertDelete dbsyncer_pointer' title='删除' ></a></td>
                        </tr>
                    </tbody>
                </table>
            </div>
        </div>
    </div>

    <!-- 隐藏表单值 -->
    <div class="form-group hidden">
        <input id="convert" name="convert" class="form-control" type="text"/>
    </div>

</div>
</html>